<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      lang="zh-cn">
<head>
    <meta content="云之讯,云通讯,云通讯平台" name="keywords"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
    <title>短信平台运营系统 </title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <link th:href="@{/resources/css/bootstrap.min14ed.css?v=3.3.6}" rel="stylesheet">
    <link th:href="@{/resources/css/font-awesome.min93e3.css?v=4.4.0}" rel="stylesheet">
    <!-- jqgrid--> 
    <link th:href="@{/resources/css/animate.min.css}" rel="stylesheet">
	<link th:href="@{/resources/css/plugins/sweetalert/sweetalert.css}" rel="stylesheet">

	<link th:href="@{/resources/css/style.min862f.css?v=4.1.0}" rel="stylesheet">
    <style>
        /* Additional style to fix warning dialog position */
        #alertmod_table_list_2 {
            top: 900px !important;
        }
    </style>
</head>
<body class="gray-bg"><div th:replace="stat :: statCode"></div>
	<div class="wrapper wrapper-content animated fadeInRight">
	    <div class="row">
	        <div class="col-sm-12">
	            <div class="ibox "> 
	                <div class="ibox-content">
						
						<div class="pull-right tooltip-demo">
							<!--<a class="btn btn-danger btn-sm" data-toggle="tooltip" data-placement="top" title="返回" onclick="javascript:self.location=document.referrer;"><i class="fa fa-reply"></i>&nbsp;返回</a>-->
						</div>
						<div class="row">
							<div class="col-sm-12">
								<div class="table-responsive">
								  <table class="table">
									<tr class="active">
										<th>模板ID</th>
										<th>模板类型</th>
										<th>短信内容</th>
										<th>归属客户ID</th>
										<th>提交类型</th>
										<th>提交时间</th>
										<th>审核状态</th>
									</tr>
									<tr>
										<td th:text="${data.template_id}"></td>
										<td th:text="${data.type_name}"></td>
										<td th:text="${data.content}"></td>
										<td th:text="${data.client_id}"></td>
										<td th:text="${data.submit_type_name}"></td>
										<td th:text="${data.create_time}"></td>
										<td th:text="${data.check_status_name}"></td>
									</tr>
								  </table>
								</div>
							</div>
						</div>
	                    <div class="row">
	                        <div class="col-sm-6 b-r">
	                            <form class="form-horizontal m-t" id="mainForm">
									<input type="hidden" name="template_id" th:value="${data.template_id }"/>
									<input type="hidden" name="last_time" th:value="${data.update_time}"/>
	                                <div class="form-group">
									    <label class="col-sm-4 control-label">供商模板ID:</label>
									    <div class="col-sm-8">
									      <p class="form-control-static con-view" th:text="${data.channel_tempid}"></p>
									    	<input type="text" class="form-control con-audit"  id="channel_tempid" name="channel_tempid"/>
									    </div> 
	                                </div>
	                                <div class="form-group">
	                                	<label class="col-sm-4 control-label">通道ID:</label>
	                                    <div class="col-sm-8">
									       <p class="form-control-static con-view" th:text="${data.channelid}"></p>
									    	<input type="text" class="form-control con-audit"  id="channelid" name="channelid"/>
	                                    </div>
	                                </div>
	                                <div class="form-group">
	                                	<label class="col-sm-4 control-label">审核结果:</label>
	                                    <div class="col-sm-8">
									       <p class="form-control-static con-view" th:text="${data.result}"></p>
									    	<input type="text" class="form-control con-audit"  id="result" name="result"/>
								        </div>
	                                </div>	                                
	                                <div class="form-group">
	                                	<label class="col-sm-4 control-label">说明:</label>
	                                	<div class="col-sm-8">
									       <p class="form-control-static con-view" th:text="${data.remark}"></p>
									    	<input type="text" class="form-control con-audit"  id="remark" name="remark"/>
	                                	</div>
	                                </div> 
								     <div class="form-group con-audit">
								        <div class="col-sm-12 col-sm-offset-3">
								            <button type="button" class="btn btn-sm btn-success" onclick="audit(this,1)">审核通过</button> 
								            <button type="button" class="btn btn-sm btn-error" onclick="audit(this,3)">审核不通过</button> 
								        </div>
								    </div>
             					</form>
	                        </div>
	                    </div>
	                </div>
	            </div>
	        </div>
	    </div>
	</div>
	<script th:src="@{/resources/js/hex_ha_ha_ha_ha_ha.js}"></script>
	<script th:src="@{/resources/js/jquery.min.js?v=2.1.4}"></script>
	<script th:src="@{/resources/js/bootstrap.min.js?v=3.3.6}"></script>
	<script th:src="@{/resources/js/plugins/peity/jquery.peity.min.js}"></script>
	<script th:src="@{/resources/js/content.min.js?v=1.0.0}"></script>
	<script th:src="@{/resources/js/date_format.min.js?v=1.0.0}"></script>
	<script th:src="@{/resources/js/jquery.form.js?v=1.0.0}"></script>

	<script th:src="@{/resources/js/plugins/sweetalert/sweetalert.min.js}"></script>
	<script th:src="@{/resources/js/plugins/validate/jquery.validate.min.js}"></script>
	<script th:src="@{/resources/js/layer/layer.js}"></script>
	<script th:src="@{/resources/js/common.js?v=1.0.0}"></script>
	
	<script th:inline="javascript">
		/*<![CDATA[*/
		  
	  	
	 	var flagStatus = /*[[${data.state}]]*/;
		var validate;
		$(function(){
			$(".con-view").hide();
			$(".con-audit").hide();
			if(flagStatus == 2){
				$(".con-audit").show();
			}else if(flagStatus == 1){
				$(".con-view").show();
			}
			$.validator.defaults.ignore = "";
			//表单验证规则
			validate = $("#mainForm").validate({
				rules: {
					channel_tempid:{
						required:true,
						minlength:1,
						maxlength:128
					},channelid:{
						required:true,
						digits:true,
						min:0,
						max:2147483647,
						minlength:1,
						maxlength:10
					},result:{
						required:true,
						minlength:1,
						maxlength:100
					},remark:{
						minlength:0,
						maxlength:100
					},
				},
				messages: {
					channel_tempid: {
						required:"请输入供应商模板ID",
						minlength:"供应商模板ID不能为空",
						maxlength:"长度不能超过128位"
					},channelid: {
						required:"请输入通道ID",
						digits:"只能输入数字",
						min:"只能输入数字",
						max:'数值超出限制',
						minlength:"通道ID不能为空",
						maxlength:"通道ID长度不超过10位"
					},result: {
						required:"请输入通道返回结果",
						minlength:"不能为空",
						maxlength:"字符长度不能超过100"
					},remark: {
						minlength:"",
						maxlength:"字符长度不能超过100"
					},
				}
			});
		});
	
		var windowIndex = parent.layer.getFrameIndex(window.name); //获取当前窗体索引
		function audit(btn,status){
			if(!validate.form()){
				return;
			}
			var options = {
				beforeSubmit : function() {
					$(btn).attr("disabled", true);
				},
				data:{
					check_status: status
				},
				success : function(data) {
					$(btn).attr("disabled", false);
					if(data.success){
						layer.msg(data.msg,{icon:1});
						window.setTimeout(function(){
							parent.location.reload();
							parent.layer.close(windowIndex );
						}, 1500);
					}else{
						layer.msg(data.msg,{icon:2});
					}
				},
				url:/*[[@{/opsAudit/smsTemplate/auditTransfer}]]*/,
				type:"POST",
				timeout:30000
			};
			layer.confirm("确定要" + $(btn).text() + "吗？", function(index){
				  $("#mainForm").ajaxSubmit(options);
				  layer.close(index);
			}); 
		}

	    /*]]>*/
	    
	</script>
</body>
</html>